package com.lnj.product.configs;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JsonConfig {

    //添加产品，类别成功后， 将multipart设为null, 通过这个配置就避免生成 json。
    @Bean
    public Jackson2ObjectMapperBuilderCustomizer customizer() {
        return builder -> builder
                .serializationInclusion(JsonInclude.Include.NON_EMPTY); // 空值不序列化
    }
}
